/**
 * Created by yananliu on 2017/11/11.
 */

export class TimeUtil{

    public static formatSeconds (value:number){
        let theTime : number = value;// 秒
        let theTime1 = 0;// 分
        let theTime2 = 0;// 小时
        if (theTime > 60) {
            theTime1 = theTime / 60;
            theTime = theTime % 60;
            if (theTime1 > 60) {
                theTime2 = theTime1 / 60;
                theTime1 = theTime1 % 60;
            }
        }
        let result : string = "" + parseInt(theTime.toString()) + "秒";
        if (theTime1 > 0) {
            result = "" + parseInt(theTime1.toString()) + "分" + result;
        }
        if (theTime2 > 0) {
            result = "" + parseInt(theTime2.toString()) + "小时" + result;
        }
        return result;
    }

}